#!/usr/bin/env sh
###
 # @Author: isaac
 # @Date: 2022-12-06 23:12:09
 # @LastEditors: isaac
 # @LastEditTime: 2022-12-07 15:53:45
 # @Description: 
### 

SPACE_ICONS=("1" "2" "3" "4" "5" "6" "7" "8")
SPACE_LABELS=(":code:" ":terminal:" ":microsoft_edge:" ":wechat:" ":music:" "zotero:" ":text:" ":microsoft_word:")
SPACE_CLICK_SCRIPT="yabai -m space --focus \$SID 2>/dev/null"

sid=0
for i in "${!SPACE_ICONS[@]}"
do
  sid=$(($i+1))
  sketchybar --add space      space.$sid left                               \
             --set space.$sid associated_space=$sid                         \
                              icon=${SPACE_ICONS[i]}                        \
                              icon.padding_left=22                          \
                              icon.padding_right=22                         \
                              label.padding_right=25                        \
                              icon.highlight_color=$BLUE                     \
                              background.padding_left=-8                    \
                              background.padding_right=-8                   \
                              background.color=$BACKGROUND_1                \
                              background.drawing=on                         \
                              label=${SPACE_LABELS[i]}                      \
                              label.font="sketchybar-app-font:Regular:16.0" \
                              label.background.height=26                    \
                              label.background.drawing=on                   \
                              label.background.color=$BACKGROUND_2  \
                              label.background.corner_radius=9              \
                              label.drawing=on                             \
                              click_script="$SPACE_CLICK_SCRIPT"
done

                              # script="$PLUGIN_DIR/space.sh"                 \
                              #
# sketchybar   --add item       separator left                          \
#              --set separator  icon=                                  \
#                               icon.font="Maple Mono SC NF:Regular:16.0" \
#                               background.padding_left=26              \
#                               background.padding_right=15             \
#                               label.drawing=off                       \
#                               associated_display=activ               \
#                               icon.color=$WHITE
